home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_300
/
399_01
/
minedmp.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-08-03
|
17KB
|
620 lines
/* ================================================================== *
* Editor mined *
* Command and character set mappings *
* ================================================================== */
#include "mined.h"
#define iso_latin_1
#ifdef msdos
#undef iso_latin_1
#undef dec_sup
#define pc_charset
#endif
/* ================================================================== *
* 8 bit character constant stuff *
* ================================================================== */
#ifdef pc_charset
char TABdefault = 250;
char SHIFT_MARK = 175; /* Char indicating that line continues */
uchar ring = 248;
#else
char TABdefault = '╖';
char SHIFT_MARK = '╗'; /* Char indicating that line continues */
uchar ring = '░';
#endif
int
idfchar (ch)
uchar ch;
{
return ('0' <= ch && ch <= '9') ||
('A' <= ch && ch <= 'Z') ||
('a' <= ch && ch <= 'z') ||
#ifdef pc_charset
((uchar) '\200' <= ch && ch <= (uchar) '\232') ||
((uchar) '\240' <= ch && ch <= (uchar) '\245') ||
((uchar) '\340' <= ch && ch <= (uchar) '\353') ||
#ifdef cp850
/* Whoever wishes to include an automatic and complete (?!) handling
of Microsoft's rotten codepage chaos, is invited to do so. */
((uchar) '\265' <= ch && ch <= (uchar) '\267') ||
((uchar) '\320' <= ch && ch <= (uchar) '\330') ||
(ch == (uchar) '\233') ||
(ch == (uchar) '\235') ||
(ch == (uchar) '\306') ||
(ch == (uchar) '\307') ||
(ch == (uchar) '\336') ||
(ch == (uchar) '\354') ||
(ch == (uchar) '\355') ||
#endif
#else
((uchar) '\300' <= ch && ch != (uchar) '╫' && ch != (uchar) '≈') ||
(ch == (uchar) '╡') ||
#endif
(ch == '_');
}
/* ================================================================== *
* MSDOS Video mode switching table *
* ================================================================== */
struct {
int mode, cols, lins;
} modetab [] =
{ /* list of available modes, unsorted, terminated by a '-1' mode */
/* the entries contain:
a video mode number (restriction to text modes preferable),
the numbers of columns and of lines which can be displayed
in that mode if a font of height 16 is used */
{42, 100, 40},
{38, 80, 60},
{36, 132, 28},
{35, 132, 25},
{34, 132, 44},
{ 3, 80, 25},
{ 1, 40, 25},
{-1, 0, 0}
};
/* ================================================================== *
* Character set coding *
* ================================================================== */
/*
* Determine a default diacritic character value for _readchar ().
* The characters are given literally except for the MSDOS version in order
* not to depend on the function of a character set translator.
* For all non-MSDOS platforms, ISO-Latin1 or the very similar
* DEC-Supplemental are assumed.
* For MSDOS, characters for the "International Codepage" ("850") are
* generated which includes the real letters (not all graphic and Greek
* characters) of the old IBM codepage ("437") (which, by the way, some
* time ago someone must have designed in an attack of mental sickness).
*/
uchar
diacritic (c)
uchar c;
{
/* the following characters cannot be inserted by this function:
⌐¬«║╝╜╛ (ISO-Latin-1) and MSDOS graphics characters */
switch (c) {
#ifdef pc_charset
case 'C' : return 128;
case 'c' : return 135;
case 'N' : return 165;
case 'n' : return 164;
case 's' : return 225;
case '!' : return 173;
case '$' : return 189;
case '/' : return 189;
case 'l' : return 156;
case 'L' : return 156;
case 'Y' : return 190;
case '+' : return 241;
case '?' : return 168;
case '0' : return 248;
case '1' : return 251;
case '2' : return 253;
case '3' : return 252;
case '<' : return 174;
case '>' : return 175;
case ':' : return 246;
case 'x' : return 158;
case 'f' : return 159;
case 'D' : return 209;
case 'd' : return 208;
case 'P' : return 232;
case 'p' : return 231;
case 'i' : return 213;
case '|' : return 221;
case '&' : return 244;
case '\\' : return 170;
case '_' : return 238;
case '-' : return 196;
case 'm' : return 230;
case '=' : return 242;
case '#' : return 245;
case '.' : return 250;
case ',' : return 247;
case '\'' : return 239;
case 'X' : return 207;
#else
case 'C' : return '╟';
case 'c' : return 'τ';
case 'N' : return '╤';
case 'n' : return '±';
case 's' : return '▀';
case '!' : return 'í';
case '$' : return 'ó';
case '/' : return 'ó';
case 'l' : return 'ú';
case 'L' : return 'ú';
case 'Y' : return 'Ñ';
case '+' : return '▒';
case '?' : return '┐';
case '0' : return '░';
case '2' : return '▓';
case '<' : return '½';
case '>' : return '╗';
case 'D' : return '╨';
case 'd' : return '≡';
case 'P' : return '▐';
case 'p' : return '■';
case '|' : return 'ª';
case '&' : return 'º';
case '\\' : return '¼';
case '_' : return '»';
case '-' : return '¡';
case 'm' : return '╡';
case '#' : return '╢';
case '.' : return '╖';
case '*' : return '╖';
case ',' : return '╕';
case '\'' : return '┤';
case '1' : return '╣';
case '3' : return '│';
#ifdef iso_latin_1
case 'X' : return 'ñ';
case '"' : return '¿';
case 'x' : return '╫';
case ':' : return '≈';
#endif
#ifdef dec_sup
case 'X' : return '¿'; /* ñ */
#endif
#endif
default: return c;
}
}
uchar
grave (ch)
uchar ch;
{
switch (ch) {
#ifdef pc_charset
case 'A' : return 183;
case 'E' : return 212;
case 'I' : return 222;
case 'O' : return 227;
case 'U' : return 235;
case 'a' : return 133;
case 'e' : return 138;
case 'i' : return 141;
case 'o' : return 149;
case 'u' : return 151;
#else
case 'A' : return '└';
case 'E' : return '╚';
case 'I' : return '╠';
case 'O' : return '╥';
case 'U' : return '┘';
case 'a' : return 'α';
case 'e' : return 'Φ';
case 'i' : return '∞';
case 'o' : return '≥';
case 'u' : return '∙';
#endif
default : return diacritic (ch);
}
}
uchar
circumflex (ch)
uchar ch;
{
switch (ch) {
#ifdef pc_charset
case 'A' : return 182;
case 'E' : return 210;
case 'I' : return 215;
case 'O' : return 226;
case 'U' : return 234;
case 'a' : return 131;
case 'e' : return 136;
case 'i' : return 140;
case 'o' : return 147;
case 'u' : return 150;
#else
case 'A' : return '┬';
case 'E' : return '╩';
case 'I' : return '╬';
case 'O' : return '╘';
case 'U' : return '█';
case 'a' : return 'Γ';
case 'e' : return 'Ω';
case 'i' : return 'ε';
case 'o' : return '⌠';
case 'u' : return '√';
#endif
default : return diacritic (ch);
}
}
uchar
acute (ch)
uchar ch;
{
switch (ch) {
#ifdef pc_charset
case 'A' : return 181;
case 'E' : return 144;
case 'I' : return 214;
case 'O' : return 224;
case 'U' : return 233;
case 'a' : return 160;
case 'e' : return 130;
case 'i' : return 161;
case 'o' : return 162;
case 'u' : return 163;
case 'Y' : return 237;
case 'y' : return 236;
case ' ' : return 239;
#else
case 'A' : return '┴';
case 'E' : return '╔';
case 'I' : return '═';
case 'O' : return '╙';
case 'U' : return '┌';
case 'a' : return 'ß';
case 'e' : return 'Θ';
case 'i' : return 'φ';
case 'o' : return '≤';
case 'u' : return '·';
case ' ' : return '┤';
#ifdef iso_latin_1
case 'Y' : return '▌';
case 'y' : return '²';
#endif
#endif
default : return diacritic (ch);
}
}
uchar
diaeresis (ch)
uchar ch;
{
switch (ch) {
#ifdef pc_charset
case 'A' : return 142;
case 'E' : return 211;
case 'I' : return 216;
case 'O' : return 153;
case 'U' : return 154;
case 'a' : return 132;
case 'e' : return 137;
case 'i' : return 139;
case 'o' : return 148;
case 'u' : return 129;
case 'y' : return 152;
case ' ' : return 249;
#else
case 'A' : return '─';
case 'E' : return '╦';
case 'I' : return '╧';
case 'O' : return '╓';
case 'U' : return '▄';
case 'a' : return 'Σ';
case 'e' : return 'δ';
case 'i' : return '∩';
case 'o' : return '÷';
case 'u' : return 'ⁿ';
#ifdef iso_latin_1
case ' ' : return '¿';
case 'y' : return '\377'; /* ' ' aborts sun compiler */
#endif
#ifdef dec_sup
case 'Y' : return '▌'; /* capital */
case 'y' : return '²'; /* */
#endif
#endif
default : return diacritic (ch);
}
}
uchar
tilde (ch)
uchar ch;
{
switch (ch) {
#ifdef pc_chars